package edu.scmu.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

@RestController
public class RequestController {


    public String simpleParam(HttpServletRequest req) {
        String name = req.getParameter("name");
        String age = req.getParameter("age");
        System.out.println("name:" + name + ",age:" + age);
        return "OK";
    }

    //http://localhost:8080/simple?name=zs&age=20
    @RequestMapping("/simple")
    public String SimpleParam2(String name, String age) {
        System.out.println("name:" + name + ",age:" + age);
        return "ok";
    }


    @PostMapping("/login")
    public String login(String name, String password) {
        System.out.println("name:" + name + ",password:" + password);
        return "ok";
    }

    @RequestMapping("/simple2")
    public String simple2(@RequestParam(value = "name") String userName, String password) {
        System.out.println("name:" + userName + ",password:" + password);
        return "ok";
    }
}
